/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kallsonys.object;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Cache;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alladiab
 */
@Entity
@Cacheable(false)
@Table(name = "ORDER_OMS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrderOms.findAll", query = "SELECT o FROM OrderOms o"),
    @NamedQuery(name = "OrderOms.findByOrderid", query = "SELECT o FROM OrderOms o WHERE o.orderid = :orderid"),
    @NamedQuery(name = "OrderOms.findByCreditcardid", query = "SELECT o FROM OrderOms o WHERE o.creditcardid = :creditcardid"),
    @NamedQuery(name = "OrderOms.findByOrderdate", query = "SELECT o FROM OrderOms o WHERE o.orderdate = :orderdate"),
    @NamedQuery(name = "OrderOms.findByOrderprice", query = "SELECT o FROM OrderOms o WHERE o.orderprice = :orderprice"),
    @NamedQuery(name = "OrderOms.findByOrdersource", query = "SELECT o FROM OrderOms o WHERE o.ordersource = :ordersource"),
    @NamedQuery(name = "OrderOms.findByOrderstatus", query = "SELECT o FROM OrderOms o WHERE o.orderstatus = :orderstatus"),
    @NamedQuery(name = "OrderOms.findByOrdercomments", query = "SELECT o FROM OrderOms o WHERE o.ordercomments = :ordercomments"),
    @NamedQuery(name = "OrderOms.findByEstimateddelivery", query = "SELECT o FROM OrderOms o WHERE o.estimateddelivery = :estimateddelivery")})
public class OrderOms implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ORDERID")
    private Long orderid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CREDITCARDID")
    private Long creditcardid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ORDERDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date orderdate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "ORDERPRICE")
    private BigDecimal orderprice;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ORDERSOURCE")
    private BigInteger ordersource;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ORDERSTATUS")
    private BigInteger orderstatus;
    @Size(max = 200)
    @Column(name = "ORDERCOMMENTS")
    private String ordercomments;
    @Column(name = "ESTIMATEDDELIVERY")
    @Temporal(TemporalType.TIMESTAMP)
    private Date estimateddelivery;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "orderid")
    private List<Orderitem> orderitemList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "orderid")
    private List<Orderquote> orderquoteList;
    @JoinColumn(name = "SHIPPINGCOMPANYID", referencedColumnName = "SHIPPINGCOMPANYID")
    @ManyToOne
    private Shippingcompany shippingcompanyid;
    @JoinColumn(name = "CUSTOMERID", referencedColumnName = "CUSTOMERID")
    @ManyToOne(optional = false)
    private Customer customerid;
    @JoinColumn(name = "ADDRESSID", referencedColumnName = "ADDRESSID")
    @ManyToOne(optional = false)
    private Address addressid;

    public OrderOms() {
    }

    public OrderOms(Long orderid) {
        this.orderid = orderid;
    }

    public OrderOms(Long orderid, Long creditcardid, Date orderdate, BigDecimal orderprice, BigInteger ordersource, BigInteger orderstatus) {
        this.orderid = orderid;
        this.creditcardid = creditcardid;
        this.orderdate = orderdate;
        this.orderprice = orderprice;
        this.ordersource = ordersource;
        this.orderstatus = orderstatus;
    }

    public Long getOrderid() {
        return orderid;
    }

    public void setOrderid(Long orderid) {
        this.orderid = orderid;
    }

    public Long getCreditcardid() {
        return creditcardid;
    }

    public void setCreditcardid(Long creditcardid) {
        this.creditcardid = creditcardid;
    }

    public Date getOrderdate() {
        return orderdate;
    }

    public void setOrderdate(Date orderdate) {
        this.orderdate = orderdate;
    }

    public BigDecimal getOrderprice() {
        return orderprice;
    }

    public void setOrderprice(BigDecimal orderprice) {
        this.orderprice = orderprice;
    }

    public BigInteger getOrdersource() {
        return ordersource;
    }

    public void setOrdersource(BigInteger ordersource) {
        this.ordersource = ordersource;
    }

    public BigInteger getOrderstatus() {
        return orderstatus;
    }

    public void setOrderstatus(BigInteger orderstatus) {
        this.orderstatus = orderstatus;
    }

    public String getOrdercomments() {
        return ordercomments;
    }

    public void setOrdercomments(String ordercomments) {
        this.ordercomments = ordercomments;
    }

    public Date getEstimateddelivery() {
        return estimateddelivery;
    }

    public void setEstimateddelivery(Date estimateddelivery) {
        this.estimateddelivery = estimateddelivery;
    }

    @XmlTransient
    public List<Orderitem> getOrderitemList() {
        return orderitemList;
    }

    public void setOrderitemList(List<Orderitem> orderitemList) {
        this.orderitemList = orderitemList;
    }

    @XmlTransient
    public List<Orderquote> getOrderquoteList() {
        return orderquoteList;
    }

    public void setOrderquoteList(List<Orderquote> orderquoteList) {
        this.orderquoteList = orderquoteList;
    }

    public Shippingcompany getShippingcompanyid() {
        return shippingcompanyid;
    }

    public void setShippingcompanyid(Shippingcompany shippingcompanyid) {
        this.shippingcompanyid = shippingcompanyid;
    }

    public Customer getCustomerid() {
        return customerid;
    }

    public void setCustomerid(Customer customerid) {
        this.customerid = customerid;
    }

    public Address getAddressid() {
        return addressid;
    }

    public void setAddressid(Address addressid) {
        this.addressid = addressid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (orderid != null ? orderid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrderOms)) {
            return false;
        }
        OrderOms other = (OrderOms) object;
        if ((this.orderid == null && other.orderid != null) || (this.orderid != null && !this.orderid.equals(other.orderid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.kallsonys.object.OrderOms[ orderid=" + orderid + " ]";
    }
    
}
